home *** CD-ROM | disk | FTP | other *** search
- property UpCM, DownCM, button_active, UpNum, DownNum, ActionHandler
-
- on getPropertyDescriptionList
- set description to [:]
- addProp(description, #DownCM, [#default: "Down", #format: #bitmap, #comment: "Pict for Down:"])
- addProp(description, #ActionHandler, [#default: "nothing", #format: #string, #comment: "Handler to execute:"])
- return description
- end
-
- on getBehaviorDescription
- return "Button, auto set up pict, switch pict down"
- end
-
- on getAssocMembers
- set myPropList to [DownCM]
- return myPropList
- end
-
- on beginSprite me
- set the UpCM of me to the member of sprite the spriteNum of me
- set the UpNum of me to the number of member UpCM
- set the DownNum of me to the number of member DownCM
- set the button_active of me to 0
- puppetSprite(the spriteNum of me, 1)
- end
-
- on endSprite me
- puppetSprite(the spriteNum of me, 0)
- end
-
- on mouseDown me
- set the member of sprite the spriteNum of me to DownNum
- set the button_active of me to 1
- end
-
- on mouseUp me
- set the member of sprite the spriteNum of me to UpNum
- set the button_active of me to 0
- do(ActionHandler)
- end
-
- on mouseUpOutSide me
- set the button_active of me to 0
- end
-
- on mouseLeave me
- if the button_active of me then
- set the member of sprite the spriteNum of me to UpNum
- end if
- end
-
- on mouseEnter me
- if the button_active of me then
- set the member of sprite the spriteNum of me to DownNum
- end if
- end
-